﻿@{
	Layout = "_LayoutPop";
	ViewBag.Title = "选择单位";
}

@section header{
}


<div class="windLayerDiv" style="">
	<table style="background-color: rgb(234, 234, 234);width:100%;" class="small" border="0" cellpadding="3" cellspacing="1">
		<tr class="detail-content-heading" style="height: 28px;">
			<td>
				<b>&nbsp;&nbsp;@ViewBag.Title</b>
			</td>
		</tr>
		<tr bgcolor="white" height="25px;">
			<td>
				<div id="orgTreeDiv" style="display: block; padding: 0 10px;">
					@*此处的最小高度与上面的一致*@
					<ul id="orgTree" class="ztree" style=""></ul>
				</div>
			</td>
		</tr>
	</table>
	<div class="windLayerFoot">
		&nbsp;
	</div>
	<div class="windLayerCorner">
		&nbsp;
	</div>
</div>
@section footer{
	<link href="~/lib/ztree/ztree.css" rel="stylesheet" asp-append-version="true" />
	<script src="~/lib/ztree/ztree.core-3.5.37.min.js" asp-append-version="true"></script>
	<script src="~/lib/ztree/ztree.exedit-3.5.37.js" asp-append-version="true"></script>
	<script type="text/javascript">
		var treeSetting = {
			view: {
				selectedMulti: false
			},
			data: {
				simpleData: {
					enable: true
				}
			},
			callback: {
				onClick: onTreeClick,
			}
		};

		function onTreeClick(event, treeId, treeNode, clickFlag) {
			var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
			parent.@(ViewData["callback"]) && parent.@(ViewData["callback"])(treeNode);
			parent.layer.close(index);
		}

		function treeRefresh() {
			utils.ajaxPost('@(Url.Action("GetZTreeData", "Sys_Organization"))', {id:""}, function (resp) {
				$.fn.zTree.init($("#orgTree"), treeSetting, resp.data);
			});
		}

		$(document).ready(function () {
			treeRefresh();
		});
	</script>
}